package timing.ukulele.gateway.client;

import timing.ukulele.common.ResponseResult;
import timing.ukulele.common.portal.SystemData;
import timing.ukulele.common.portal.UserData;
import timing.ukulele.gateway.client.callback.PortalClientCallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(value = "ukulele-portal", path = "portal", fallback = PortalClientCallback.class)
public interface PortalClient {

    @GetMapping("api/user/findByUsername")
    ResponseResult<UserData> findByUsername(@RequestParam("username") String username);

    @GetMapping("api/system/getSystemIdByUserId/{userId}")
    ResponseResult<List<Long>> getSystemIdByUserId(@PathVariable("userId") Long userId);

    @GetMapping("api/system/getById/{id}")
    ResponseResult<SystemData> getSystemById(@PathVariable("id") String id);
}
